const timer = 1000 * 60 * 60 * 5

// 设置登录时的时间
export const setTime = () => {
  localStorage.setItem('tokenTime', Date.now())
}

// 获取时间
export const getTime = () => {
  return localStorage.getItem('tokenTime')
}

// 对比时间差是否失效
export const diffTime = () => {
  // 获取现在时间
  const currentTime = Date.now()
  const tokenTime = getTime()
  return currentTime - tokenTime > timer
}
